﻿@model IEnumerable<RTW.Models.TDepartment>
@{
    Layout = null;
}

<ul>
    @foreach (var dpt in Model)
    {
    <li class="jstree-open">

        @if (dpt.Bak1 != "")
        {
            <span class="sDMName" DMID="@dpt.ID">
                @dpt.RowIndex
                .
                @dpt.DMName
                (
                @if (dpt.Flag1 == 1)
                {
                    <span style="color:red;margin-left:0px;">部门</span>
                }
                else
                {
                    <span style="color:blue;margin-left:0px;">问题</span>
                }
                )
            </span>
        }
        else
        {
            <span>
                @dpt.RowIndex
                .
                @dpt.DMName
                (
                @if (dpt.Flag1 == 1)
                {
                    <span style="color:red;margin-left:0px;">部门</span>
                }
                else
                {
                    <span style="color:blue;margin-left:0px;">问题</span>
                }
                )
            </span>
        }
        <div>
            <span class="text-info" onclick="location.href ='@Url.Action("OrgManager","Department",new { area="System"})?DMID=@dpt.ID' ">部门管理</span>
            <span class="text-warning" onclick="showPage('添加子公司','@Url.Action("edit","Department",new { area="System"})?ParentID=@dpt.ID',500,620,true)">添加子节点</span>
            <span class="text-success" onclick="showPage('编辑','@Url.Action("edit","Department",new { area="System"})?ID=@dpt.ID',500,620,true)">编辑</span>
            <span class="text-danger" onclick="DelDepartment(@dpt.ID)">删除</span>
        </div>
        @if (dpt.DMS != null && dpt.DMS.Count > 0)
        {
        <ul>
            @foreach (var sdpt in dpt.DMS)
            {

                <li class="jstree-open">

                    @if (sdpt.Bak1 != "")
                    {
                        <span class="sDMName" DMID="@sdpt.ID">
                            @sdpt.RowIndex
                            .
                            @sdpt.DMName
                            (
                            @if (sdpt.Flag1 == 1)
                            {
                                <span style="color:red;margin-left:0px;">部门</span>
                            }
                            else
                            {
                                <span style="color:blue;margin-left:0px;">问题</span>
                            }
                            )
                        </span>
                    }
                    else
                    {
                        <span>
                            @sdpt.RowIndex
                            .
                            @sdpt.DMName
                            (
                            @if (sdpt.Flag1 == 1)
                            {
                                <span style="color:red;margin-left:0px;">部门</span>
                            }
                            else
                            {
                                <span style="color:blue;margin-left:0px;">问题</span>
                            }
                            )
                        </span>
                        @Url.Action("edit", "Department", new { area = "System" })
                    }
                    <div>
                        <span class="text-info" onclick="location.href ='@Url.Action("OrgManager", "Department", new { area = "System" })?DMID=@sdpt.ID' ">部门管理</span>
                        <span class="text-warning" onclick="showPage('添加子公司','@Url.Action("edit", "Department", new { area = "System" })?ParentID=@sdpt.ID',500,620,true)">添加子节点</span>
                        <span class="text-success" onclick="showPage('编辑','@Url.Action("edit", "Department", new { area = "System" })?ID=@sdpt.ID',500,620,true)">编辑</span>
                        <span class="text-danger" onclick="DelDepartment(@sdpt.ID)">删除</span>
                    </div>
                    </li>
                    }
            </ul>
        }
        </li>
    }

</ul>

